//
//  XJCmtChargeSectionHeaderView.m
//  XinJiangMall
//0
//  Created by RaoBo on 2018/7/17.
//  Copyright © 2018年 Tzyang. All rights reserved.
//

#import "XJCmtChargeSectionHeaderView.h"
@interface XJCmtChargeSectionHeaderView()
@property (nonatomic, strong) UIView *bgView;

@property (nonatomic, strong) UILabel *titleLb;//标题
@end

@implementation XJCmtChargeSectionHeaderView

#pragma mark - 一 lazy
- (UIView *)bgView {
    if (!_bgView) {
        _bgView = [UIView new];
        _bgView.backgroundColor = [UIColor whiteColor];
    }
    return _bgView;
}
- (UILabel *)titleLb {
    if (!_titleLb) {
        _titleLb = [UILabel new];
        _titleLb.font = [UIFont systemFontOfSize:20.0];
    }
    return _titleLb;
}

#pragma mark - 二 init

- (instancetype)initWithReuseIdentifier:(NSString *)reuseIdentifier {
    
    if (self = [super initWithReuseIdentifier:reuseIdentifier]) {
        [self setupView];
    }
    return self;
}

- (void)setupView {
    [self.contentView addSubview:self.bgView];
    [self.bgView addSubview:self.titleLb];
}

#pragma mark - 三 lazy

- (void)layoutSubviews {
    [super layoutSubviews];
    
    [self.bgView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.edges.equalTo(self.contentView);
    }];
    
    CGFloat k15 = 15.0;
    
    [self.titleLb mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(self.bgView.mas_left).offset(k15);
        make.right.equalTo(self.bgView.mas_right).offset(-k15);
        make.centerY.equalTo(self.bgView.mas_centerY);
        make.height.mas_equalTo(25);
    }];
}

#pragma mark - 四 configure
- (void)configureXJCmtChargeSectionHeaderViewWithTitle:(NSString *)title {
    self.titleLb.text = title;
}



@end
